<template>
  <view class="body">
    <view class="phone">
      <view class="phone-item">
        手机号
      </view>
      <input type="number" name="phone" value="" v-model="form.userPhone" disabled
        placeholder-style="color:#AAAAAA; font-size:28rpx;" maxlength="11" placeholder="请输入您的手机号码" />
    </view>
    <view class="phone">
      <view class="phone-item">
        登录密码
      </view>
      <input type="text" name="phone" value="" v-model="form.psword" placeholder-style="color:#AAAAAA; font-size:28rpx;"
        placeholder="请输入登录密码" />
    </view>
    <view class="tig">注意：注销账户提交后，工作人员会及时处理。</view>

    <view class="button">
      <button form-type="submit" @click="submit">立即注销</button>
    </view>
  </view>
</template>

<script>
  import {
    myInfo,
    logout
  } from "@/api/login.js"
  export default {
    data() {
      return {
        form: {
          userPhone: "",
        }
      }
    },
    onLoad() {
      this.getUserInfo()
    },
    methods: {
      getUserInfo() {
        this.$http.get("/account/app-info").then(res => {
          if (res && res.code == 200) {
            this.form.userPhone = res.data.mobile
          }
        })
      },
      submit() {
        let that = this;
        if (!this.form.psword || this.form.psword.length < 6) {
          uni.showToast({
            icon: "none",
            title: '请输入正确的密码',
            duration: 2000
          });
        } else {
          uni.showModal({
            title: '提示',
            content: '确定提交注销申请？',
            success: function(res) {
              if (res.confirm) {
                that.$mUtil.toast("您的注销申请已收到，工作人员会尽量联系处理");
                setTimeout(() => {
                  uni.navigateBack()
                }, 2000)
              }
            }
          });
        }
      },
    }
  }
</script>

<style lang="scss" scoped>
  .body {
    .phone {
      margin: 0 65rpx;
      display: flex;
      padding: 27rpx 0 30rpx 0;
      align-items: center;
      border-bottom: 1rpx solid #E6E6E6;

      .phone-item {
        font-size: 28rpx;
        font-weight: 400;
        color: #474747;

      }

      input {
        flex: 1;
        margin-left: 60rpx;
      }
    }

    .tig {
      padding: 30rpx 0  0 65rpx;
      font-size: 24rpx;
	  color: #AAAAAA;
    }

    .button {
      margin: 700rpx 30rpx 0 30rpx;

      button {
        font-size: 36rpx;
        color: #ffffff;
        font-weight: 400;
        background-color: #FF721B;
        border-radius: 20rpx;
      }
    }
	/deep/ .uni-input-input {
		color: #AAAAAA;
	}
  }
</style>
